package com.juc.function;

import java.util.function.Consumer;

/**
 * Consumer 消费型接口: 只有输入，没有返回值
 */
public class Demo3 {
    public static void main(String[] args) {
        // 简化前
        Consumer<String> consumer1 = new Consumer<String>() {
            @Override
            public void accept(String str) {
                System.out.println(str);
            }
        };
        // 简化后
        Consumer<String> consumer2 = System.out::println;
        consumer1.accept("a");
        consumer2.accept("b");
    }
}
